/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.business.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseBusiness;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Date;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
* @website https://el-admin.vip
* @description /
* @author xiahongbo
* @date 2022-07-18
**/
@Entity
@Data
@Table(name="BIS_WHFA")
public class Whfa extends BaseBusiness implements Serializable {

    @Id
    @Column(name = "BIS_WHFA_ID")
    @ApiModelProperty(value = "主键")
    private String bisWhfaId;

    @Column(name = "BIS_WHFA_ZHSQ_ID")
    @ApiModelProperty(value = "照护ID")
    private Long bisWhfaZhsqId;

    @Column(name = "BIS_WHFA_HWRQ")
    @ApiModelProperty(value = "方案实施日期")
    private String bisWhfaHwrq;

    @Column(name = "BIS_WHFA_START_TIME")
    @ApiModelProperty(value = "起始钟点")
    private String bisWhfaStartTime;

    @Column(name = "BIS_WHFA_END_TIME")
    @ApiModelProperty(value = "结束钟点")
    private String bisWhfaEndTime;

    @Column(name = "BIS_WHFA_ZT")
    @ApiModelProperty(value = "方案状态")
    private String bisWhfaZt;

    @Column(name = "BIS_WHFA_FWLX")
    @ApiModelProperty(value = "服务类型")
    private String bisWhfaFwlx;

    @OneToMany(mappedBy = "whfa",cascade={CascadeType.PERSIST,CascadeType.REMOVE})
    private List<WhfaFfx> whfaFfxes;

    public void copy(Whfa source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    @Override
    public int hashCode() {
        return Objects.hash(bisWhfaId, bisWhfaZhsqId);
    }
}